//
//  PropertyTableViewCell.m
//  TriumphInTheSkiesAPP
//
//  Created by 要帅气的生活 on 15/11/3.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "PropertyTableViewCell.h"
#import "PropertyModel.h"
#import "Size.h"
#import "ToolUtil.h"
#import "UIImageView+WebCache.h"

@implementation PropertyTableViewCell


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self.contentView addSubview:self.aImageView];
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.addressLabel];
        [self.contentView addSubview:self.contentLabel];
        [self.contentView addSubview:self.moneyLabel];
    }
    return self;
}
- (void)setPropertyModel:(PropertyModel *)propertyModel
{
    [self.aImageView sd_setImageWithURL:[NSURL URLWithString:propertyModel.imageUrl] placeholderImage:[UIImage imageNamed:@""]];
    self.titleLabel.frame = CGRectMake(CGRectGetMaxX(self.aImageView.frame)+ 8, self.aImageView.frame.origin.y + 10 , 50, 30);
    self.titleLabel.text = propertyModel.title;
    
    self.addressLabel.text = propertyModel.address;
    self.contentLabel.text = propertyModel.content;
    self.moneyLabel.text = propertyModel.money;
}
- (UIImageView *)aImageView
{
    if (_aImageView == nil) {
        self.aImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, WindowWidth / 3 * 1.3, margin_100)];
        _aImageView.backgroundColor = [UIColor grayColor];
        
    }
    return _aImageView;
}
- (UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.aImageView.frame)+ 8, self.aImageView.frame.origin.y + 10 , [ToolUtil autoWidth:@"意大利阳光公寓" width:0 height:margin_20 num:17], 20)];
        _titleLabel.font = FONT(17);
        _titleLabel.text = @"意大利阳光公寓";
//        _titleLabel.backgroundColor = DEBUG_CLOLR;
        _titleLabel.numberOfLines = 0;
        
    }
    return _titleLabel;
}
- (UILabel *)addressLabel
{
    if (_addressLabel == nil) {
        self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.aImageView.frame)+ 8,CGRectGetMaxY(self.titleLabel.frame) + 5 , 50, 30)];
        _addressLabel.font = FONT(15);
        _addressLabel.text = @"意大利";
//        _addressLabel.backgroundColor = DEBUG_CLOLR;
        _addressLabel.numberOfLines = 0;
        
    }
    return _addressLabel;
}
- (UILabel *)contentLabel
{
    if (_contentLabel == nil) {
        self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.aImageView.frame)+ 8, CGRectGetMaxY(self.addressLabel.frame) + 5 , [ToolUtil autoWidth:@"这里风和日丽 依山伴湖 空气清新" width:0 height:30 num:13], 30)];
        _contentLabel.font = FONT(13);
        _contentLabel.text = @"这里风和日丽 依山伴湖 空气清新";
//        _contentLabel.backgroundColor = DEBUG_CLOLR;
        _contentLabel.numberOfLines = 0;
        
    }
    return _contentLabel;
}
- (UILabel *)moneyLabel
{
    if (_moneyLabel == nil) {
        self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(WindowWidth - 50, self.titleLabel.frame.origin.y + 10 , 50, 30)];
        _moneyLabel.font = FONT(10);
        _moneyLabel.text = @"250万起";
//        _moneyLabel.backgroundColor = DEBUG_CLOLR;
        _moneyLabel.numberOfLines = 0;
        
    }
    return _moneyLabel;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
